﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DatabaseCore
{
    public partial class tbl_OrderDetail
    {
        public int ATP { get; set; }
        public int ATPSB { get; set; }
        public int ATPRY { get; set; }
        public int ATPTotal { get; set; }
        public int DefaultPercent { get; set; }
        public bool CanTransfer()
        {
            var transferQty =   this.Qty * (this.Rate ?? 20) / 100;
            return ATP >= transferQty;
        }

        public int TransferQty
        {
            get
            {
                if (ApproveQty == null)
                {
                    ApproveQty = Qty;
                }

                if (ApproveQty > ATP)
                {
                    return ATP;
                }
                else
                {
                    return ApproveQty ?? Qty;
                }

            }
        }
    }
}
